#include "sys_config.h"
#include "led.h"

#define LOG_TAG "main"
#define LOG_LEVEL LOG_LEVEL_VERBOSE
#include "logger.h"

void bsp_init(void)
{
    hal_sys_clock_init(SYS_CLOCK_FREQUENCY_72M);
    hal_systick_init(SYS_CLOCK_FREQUENCY_72M/SYS_TICK_CNT);

    logger_init();

    LOG_I("System Init OK!\r\n");
    LOG_I("Building at %s %s\r\n",__DATE__,__TIME__);
    LOG_I("System Version: %s", VERSION_NAME);
}

int main(void)
{
    mfU8_t recv_buf[1200] = {0};
    mfU16_t recv_len = 0;
    bsp_init();

    led_init(LED2, 0);
    led_init(LED3, 0);
    led_init(LED4, 0);
    led_init(LED5, 0);
    
    led_on(LED2);
    led_off(LED3);
    led_on(LED4);
    led_off(LED5);

    while(1)
    {
        LOG_I("LED Trigger\r\n");
        led_trigger(LED2);
        led_trigger(LED3);
        led_trigger(LED4);
        led_trigger(LED5);
        hal_delay_ms(500);
    }
}
